package com.chtw.vuedemo.service.impl;

import com.chtw.vuedemo.bean.News;
import com.chtw.vuedemo.bean.NewsExample;
import com.chtw.vuedemo.mapper.NewsMapper;
import com.chtw.vuedemo.service.inf.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author chtw
 * @date 2020-10-04 14:18
 */
@Service
public class NewsServiceImpl implements NewsService {

    @Autowired
    private NewsMapper newsMapper;

    @Override
    public List<News> list() {
        return newsMapper.selectByExample(new NewsExample());
    }

    @Override
    public News getById(int id) {
        return newsMapper.selectByPrimaryKey(id);
    }
}
